// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// ResourceBundle represent a collection of kubernetes configuration resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceBundle {
    /// Identifier. Name of the `ResourceBundle`. Format is
    /// `projects/{project}/locations/{location}/resourceBundle
    /// /[a-z][a-z0-9\-]{0,62}`.
    pub name: std::string::String,

    /// Output only. Time `ResourceBundle` was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Time `ResourceBundle` was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Labels as key value pairs.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. Human readable description of the `ResourceBundle`.
    pub description: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceBundle {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ResourceBundle::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ResourceBundle::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ResourceBundle::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::ResourceBundle::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::ResourceBundle::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::ResourceBundle::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [description][crate::model::ResourceBundle::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }
}

impl wkt::message::Message for ResourceBundle {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ResourceBundle"
    }
}

/// Message for requesting list of ResourceBundles.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourceBundlesRequest {
    /// Required. Parent value for ListResourceBundlesRequest.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourceBundlesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListResourceBundlesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListResourceBundlesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListResourceBundlesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListResourceBundlesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListResourceBundlesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListResourceBundlesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListResourceBundlesRequest"
    }
}

/// Message for response to listing ResourceBundles.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListResourceBundlesResponse {
    /// The list of ResourceBundle.
    pub resource_bundles: std::vec::Vec<crate::model::ResourceBundle>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListResourceBundlesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [resource_bundles][crate::model::ListResourceBundlesResponse::resource_bundles].
    pub fn set_resource_bundles<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ResourceBundle>,
    {
        use std::iter::Iterator;
        self.resource_bundles = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListResourceBundlesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListResourceBundlesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListResourceBundlesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListResourceBundlesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListResourceBundlesResponse {
    type PageItem = crate::model::ResourceBundle;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.resource_bundles
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a ResourceBundle.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetResourceBundleRequest {
    /// Required. Name of the resource.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetResourceBundleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetResourceBundleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetResourceBundleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.GetResourceBundleRequest"
    }
}

/// Message for creating a ResourceBundle.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateResourceBundleRequest {
    /// Required. Value for parent.
    pub parent: std::string::String,

    /// Required. Id of the requesting object
    /// If auto-generating Id server-side, remove this field and
    /// resource_bundle_id from the method_signature of Create RPC
    pub resource_bundle_id: std::string::String,

    /// Required. The resource being created
    pub resource_bundle: std::option::Option<crate::model::ResourceBundle>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateResourceBundleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateResourceBundleRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [resource_bundle_id][crate::model::CreateResourceBundleRequest::resource_bundle_id].
    pub fn set_resource_bundle_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.resource_bundle_id = v.into();
        self
    }

    /// Sets the value of [resource_bundle][crate::model::CreateResourceBundleRequest::resource_bundle].
    pub fn set_resource_bundle<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundle>,
    {
        self.resource_bundle = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [resource_bundle][crate::model::CreateResourceBundleRequest::resource_bundle].
    pub fn set_or_clear_resource_bundle<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundle>,
    {
        self.resource_bundle = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateResourceBundleRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateResourceBundleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.CreateResourceBundleRequest"
    }
}

/// Message for updating a ResourceBundle
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateResourceBundleRequest {
    /// Required. Field mask is used to specify the fields to be overwritten in the
    /// ResourceBundle resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The resource being updated
    pub resource_bundle: std::option::Option<crate::model::ResourceBundle>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateResourceBundleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateResourceBundleRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateResourceBundleRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [resource_bundle][crate::model::UpdateResourceBundleRequest::resource_bundle].
    pub fn set_resource_bundle<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundle>,
    {
        self.resource_bundle = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [resource_bundle][crate::model::UpdateResourceBundleRequest::resource_bundle].
    pub fn set_or_clear_resource_bundle<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundle>,
    {
        self.resource_bundle = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateResourceBundleRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateResourceBundleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.UpdateResourceBundleRequest"
    }
}

/// Message for deleting a ResourceBundle
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteResourceBundleRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. If set to true, any releases of this resource bundle will also be
    /// deleted. (Otherwise, the request will only work if the resource bundle has
    /// no releases.)
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteResourceBundleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteResourceBundleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteResourceBundleRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteResourceBundleRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteResourceBundleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.DeleteResourceBundleRequest"
    }
}

/// A `FleetPackage` resource in the Config Delivery API.
///
/// A `FleetPackage` defines a package through which kubernetes
/// configuration is deployed to a fleet of kubernetes clusters.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FleetPackage {
    /// Identifier. Name of the `FleetPackage`. Format is
    /// `projects/{project}/locations/{location}/fleetPackages/{fleetPackage}`.
    /// The `fleetPackage` component must match
    /// `[a-z][a-z0-9\-]{0,62}`
    pub name: std::string::String,

    /// Output only. Time at which the `FleetPackage` was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Most recent time at which the `FleetPackage` was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Labels are attributes that can be set and used by both the
    /// user and by Config Delivery. Labels must meet the following constraints:
    ///
    /// * Keys and values can contain only lowercase letters, numeric characters,
    ///   underscores, and dashes.
    /// * All characters must use UTF-8 encoding, and international characters are
    ///   allowed.
    /// * Keys must start with a lowercase letter or international character.
    /// * Each resource is limited to a maximum of 64 labels.
    ///
    /// Both keys and values are additionally constrained to be <= 128 bytes.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Information specifying the source of kubernetes configuration to
    /// deploy.
    pub resource_bundle_selector:
        std::option::Option<crate::model::fleet_package::ResourceBundleSelector>,

    /// Optional. Configuration to select target clusters to deploy kubernetes
    /// configuration to.
    pub target: std::option::Option<crate::model::fleet_package::Target>,

    /// Optional. The strategy to use to deploy kubernetes configuration to
    /// clusters.
    pub rollout_strategy: std::option::Option<crate::model::RolloutStrategy>,

    /// Required. Information specifying how to map a `ResourceBundle` variant to a
    /// target cluster.
    pub variant_selector: std::option::Option<crate::model::fleet_package::VariantSelector>,

    /// Output only. Information containing the rollout status of the
    /// `FleetPackage` across all the target clusters.
    pub info: std::option::Option<crate::model::FleetPackageInfo>,

    /// Optional. Information around how to handle kubernetes resources at the
    /// target clusters when the `FleetPackage` is deleted.
    pub deletion_propagation_policy: crate::model::DeletionPropagationPolicy,

    /// Optional. The desired state of the fleet package.
    pub state: crate::model::fleet_package::State,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl FleetPackage {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::FleetPackage::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::FleetPackage::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::FleetPackage::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::FleetPackage::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::FleetPackage::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::FleetPackage::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [resource_bundle_selector][crate::model::FleetPackage::resource_bundle_selector].
    pub fn set_resource_bundle_selector<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::fleet_package::ResourceBundleSelector>,
    {
        self.resource_bundle_selector = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [resource_bundle_selector][crate::model::FleetPackage::resource_bundle_selector].
    pub fn set_or_clear_resource_bundle_selector<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::fleet_package::ResourceBundleSelector>,
    {
        self.resource_bundle_selector = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::FleetPackage::target].
    pub fn set_target<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::fleet_package::Target>,
    {
        self.target = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [target][crate::model::FleetPackage::target].
    pub fn set_or_clear_target<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::fleet_package::Target>,
    {
        self.target = v.map(|x| x.into());
        self
    }

    /// Sets the value of [rollout_strategy][crate::model::FleetPackage::rollout_strategy].
    pub fn set_rollout_strategy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RolloutStrategy>,
    {
        self.rollout_strategy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rollout_strategy][crate::model::FleetPackage::rollout_strategy].
    pub fn set_or_clear_rollout_strategy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RolloutStrategy>,
    {
        self.rollout_strategy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [variant_selector][crate::model::FleetPackage::variant_selector].
    pub fn set_variant_selector<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::fleet_package::VariantSelector>,
    {
        self.variant_selector = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [variant_selector][crate::model::FleetPackage::variant_selector].
    pub fn set_or_clear_variant_selector<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::fleet_package::VariantSelector>,
    {
        self.variant_selector = v.map(|x| x.into());
        self
    }

    /// Sets the value of [info][crate::model::FleetPackage::info].
    pub fn set_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::FleetPackageInfo>,
    {
        self.info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [info][crate::model::FleetPackage::info].
    pub fn set_or_clear_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::FleetPackageInfo>,
    {
        self.info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [deletion_propagation_policy][crate::model::FleetPackage::deletion_propagation_policy].
    pub fn set_deletion_propagation_policy<
        T: std::convert::Into<crate::model::DeletionPropagationPolicy>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.deletion_propagation_policy = v.into();
        self
    }

    /// Sets the value of [state][crate::model::FleetPackage::state].
    pub fn set_state<T: std::convert::Into<crate::model::fleet_package::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }
}

impl wkt::message::Message for FleetPackage {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackage"
    }
}

/// Defines additional types related to [FleetPackage].
pub mod fleet_package {
    #[allow(unused_imports)]
    use super::*;

    /// Information specifying the source of kubernetes configuration to deploy.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ResourceBundleSelector {
        /// source can be a directly pushed `ResourceBundle` or
        /// `CloudBuildRepository` containing the kubernetes configuration.
        pub source:
            std::option::Option<crate::model::fleet_package::resource_bundle_selector::Source>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ResourceBundleSelector {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [source][crate::model::fleet_package::ResourceBundleSelector::source].
        ///
        /// Note that all the setters affecting `source` are mutually
        /// exclusive.
        pub fn set_source<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::fleet_package::resource_bundle_selector::Source,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.source = v.into();
            self
        }

        /// The value of [source][crate::model::fleet_package::ResourceBundleSelector::source]
        /// if it holds a `ResourceBundle`, `None` if the field is not set or
        /// holds a different branch.
        pub fn resource_bundle(
            &self,
        ) -> std::option::Option<&std::boxed::Box<crate::model::fleet_package::ResourceBundleTag>>
        {
            #[allow(unreachable_patterns)]
            self.source.as_ref().and_then(|v| match v {
                crate::model::fleet_package::resource_bundle_selector::Source::ResourceBundle(
                    v,
                ) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [source][crate::model::fleet_package::ResourceBundleSelector::source]
        /// to hold a `ResourceBundle`.
        ///
        /// Note that all the setters affecting `source` are
        /// mutually exclusive.
        pub fn set_resource_bundle<
            T: std::convert::Into<std::boxed::Box<crate::model::fleet_package::ResourceBundleTag>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.source = std::option::Option::Some(
                crate::model::fleet_package::resource_bundle_selector::Source::ResourceBundle(
                    v.into(),
                ),
            );
            self
        }

        /// The value of [source][crate::model::fleet_package::ResourceBundleSelector::source]
        /// if it holds a `CloudBuildRepository`, `None` if the field is not set or
        /// holds a different branch.
        pub fn cloud_build_repository(
            &self,
        ) -> std::option::Option<&std::boxed::Box<crate::model::fleet_package::CloudBuildRepository>>
        {
            #[allow(unreachable_patterns)]
            self.source.as_ref().and_then(|v| match v {
                crate::model::fleet_package::resource_bundle_selector::Source::CloudBuildRepository(v) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [source][crate::model::fleet_package::ResourceBundleSelector::source]
        /// to hold a `CloudBuildRepository`.
        ///
        /// Note that all the setters affecting `source` are
        /// mutually exclusive.
        pub fn set_cloud_build_repository<
            T: std::convert::Into<std::boxed::Box<crate::model::fleet_package::CloudBuildRepository>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.source = std::option::Option::Some(
                crate::model::fleet_package::resource_bundle_selector::Source::CloudBuildRepository(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for ResourceBundleSelector {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackage.ResourceBundleSelector"
        }
    }

    /// Defines additional types related to [ResourceBundleSelector].
    pub mod resource_bundle_selector {
        #[allow(unused_imports)]
        use super::*;

        /// source can be a directly pushed `ResourceBundle` or
        /// `CloudBuildRepository` containing the kubernetes configuration.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Source {
            /// Information specifying `ResourceBundle`.
            ResourceBundle(std::boxed::Box<crate::model::fleet_package::ResourceBundleTag>),
            /// Information specifying `CloudBuildRepository`.
            CloudBuildRepository(
                std::boxed::Box<crate::model::fleet_package::CloudBuildRepository>,
            ),
        }
    }

    /// ResourceBundleTag contains the information to refer to a release for a
    /// `ResourceBundle`.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct ResourceBundleTag {
        /// Required. Name of the `ResourceBundle`.
        /// Format is projects/{p}/locations/{l}/resourceBundles/{r}.
        pub name: std::string::String,

        /// Required. Tag refers to a version of the release in a `ResourceBundle`.
        /// This is a Git tag in the semantic version format `vX.Y.Z`.
        pub tag: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl ResourceBundleTag {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name][crate::model::fleet_package::ResourceBundleTag::name].
        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.name = v.into();
            self
        }

        /// Sets the value of [tag][crate::model::fleet_package::ResourceBundleTag::tag].
        pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.tag = v.into();
            self
        }
    }

    impl wkt::message::Message for ResourceBundleTag {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackage.ResourceBundleTag"
        }
    }

    /// CloudBuildRepository contains information about fetching Kubernetes
    /// configuration from a `CloudBuildRepository`.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CloudBuildRepository {
        /// Required. Name of the cloud build repository.
        /// Format is projects/{p}/locations/{l}/connections/{c}/repositories/{r}.
        pub name: std::string::String,

        /// Optional. path to the directory or file within the repository that
        /// contains the kubernetes configuration. If unspecified, path is assumed to
        /// the top level root directory of the repository.
        pub path: std::string::String,

        /// Required. git tag of the underlying git repository.
        /// The git tag must be in the semantic version format `vX.Y.Z`.
        pub tag: std::string::String,

        /// Required. Google service account to use in CloudBuild triggers to fetch
        /// and store kubernetes configuration.
        pub service_account: std::string::String,

        /// variants_pattern is the configuration for how to read the repository
        /// to find variants.
        pub variants:
            std::option::Option<crate::model::fleet_package::cloud_build_repository::Variants>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CloudBuildRepository {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name][crate::model::fleet_package::CloudBuildRepository::name].
        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.name = v.into();
            self
        }

        /// Sets the value of [path][crate::model::fleet_package::CloudBuildRepository::path].
        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.path = v.into();
            self
        }

        /// Sets the value of [tag][crate::model::fleet_package::CloudBuildRepository::tag].
        pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.tag = v.into();
            self
        }

        /// Sets the value of [service_account][crate::model::fleet_package::CloudBuildRepository::service_account].
        pub fn set_service_account<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.service_account = v.into();
            self
        }

        /// Sets the value of [variants][crate::model::fleet_package::CloudBuildRepository::variants].
        ///
        /// Note that all the setters affecting `variants` are mutually
        /// exclusive.
        pub fn set_variants<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::fleet_package::cloud_build_repository::Variants,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.variants = v.into();
            self
        }

        /// The value of [variants][crate::model::fleet_package::CloudBuildRepository::variants]
        /// if it holds a `VariantsPattern`, `None` if the field is not set or
        /// holds a different branch.
        pub fn variants_pattern(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.variants.as_ref().and_then(|v| match v {
                crate::model::fleet_package::cloud_build_repository::Variants::VariantsPattern(
                    v,
                ) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [variants][crate::model::fleet_package::CloudBuildRepository::variants]
        /// to hold a `VariantsPattern`.
        ///
        /// Note that all the setters affecting `variants` are
        /// mutually exclusive.
        pub fn set_variants_pattern<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.variants = std::option::Option::Some(
                crate::model::fleet_package::cloud_build_repository::Variants::VariantsPattern(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for CloudBuildRepository {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackage.CloudBuildRepository"
        }
    }

    /// Defines additional types related to [CloudBuildRepository].
    pub mod cloud_build_repository {
        #[allow(unused_imports)]
        use super::*;

        /// variants_pattern is the configuration for how to read the repository
        /// to find variants.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Variants {
            /// Optional. variants_pattern is a glob pattern that will be used to find
            /// variants in the repository. Examples: `variants/*.yaml`, `us-*`
            VariantsPattern(std::string::String),
        }
    }

    /// The target defines different ways to target set of kubernetes clusters.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Target {
        /// target for the fleet package.
        pub target: std::option::Option<crate::model::fleet_package::target::Target>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Target {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [target][crate::model::fleet_package::Target::target].
        ///
        /// Note that all the setters affecting `target` are mutually
        /// exclusive.
        pub fn set_target<
            T: std::convert::Into<std::option::Option<crate::model::fleet_package::target::Target>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.target = v.into();
            self
        }

        /// The value of [target][crate::model::fleet_package::Target::target]
        /// if it holds a `Fleet`, `None` if the field is not set or
        /// holds a different branch.
        pub fn fleet(&self) -> std::option::Option<&std::boxed::Box<crate::model::Fleet>> {
            #[allow(unreachable_patterns)]
            self.target.as_ref().and_then(|v| match v {
                crate::model::fleet_package::target::Target::Fleet(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [target][crate::model::fleet_package::Target::target]
        /// to hold a `Fleet`.
        ///
        /// Note that all the setters affecting `target` are
        /// mutually exclusive.
        pub fn set_fleet<T: std::convert::Into<std::boxed::Box<crate::model::Fleet>>>(
            mut self,
            v: T,
        ) -> Self {
            self.target = std::option::Option::Some(
                crate::model::fleet_package::target::Target::Fleet(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for Target {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackage.Target"
        }
    }

    /// Defines additional types related to [Target].
    pub mod target {
        #[allow(unused_imports)]
        use super::*;

        /// target for the fleet package.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Target {
            /// The GKE fleet information.
            Fleet(std::boxed::Box<crate::model::Fleet>),
        }
    }

    /// VariantSelector contains information for selecting a variant in
    /// `ResourceBundle` to deploy to a target cluster.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct VariantSelector {
        /// strategy for selecting a variant.
        pub strategy: std::option::Option<crate::model::fleet_package::variant_selector::Strategy>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl VariantSelector {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [strategy][crate::model::fleet_package::VariantSelector::strategy].
        ///
        /// Note that all the setters affecting `strategy` are mutually
        /// exclusive.
        pub fn set_strategy<
            T: std::convert::Into<
                    std::option::Option<crate::model::fleet_package::variant_selector::Strategy>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.strategy = v.into();
            self
        }

        /// The value of [strategy][crate::model::fleet_package::VariantSelector::strategy]
        /// if it holds a `VariantNameTemplate`, `None` if the field is not set or
        /// holds a different branch.
        pub fn variant_name_template(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.strategy.as_ref().and_then(|v| match v {
                crate::model::fleet_package::variant_selector::Strategy::VariantNameTemplate(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [strategy][crate::model::fleet_package::VariantSelector::strategy]
        /// to hold a `VariantNameTemplate`.
        ///
        /// Note that all the setters affecting `strategy` are
        /// mutually exclusive.
        pub fn set_variant_name_template<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.strategy = std::option::Option::Some(
                crate::model::fleet_package::variant_selector::Strategy::VariantNameTemplate(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for VariantSelector {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackage.VariantSelector"
        }
    }

    /// Defines additional types related to [VariantSelector].
    pub mod variant_selector {
        #[allow(unused_imports)]
        use super::*;

        /// strategy for selecting a variant.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Strategy {
            /// Required. variant_name_template is a template that can refer to
            /// variables containing cluster membership metadata such as location,
            /// name, and labels to generate the name of the variant for a target
            /// cluster. The variable syntax is similar to the unix shell variables.
            ///
            /// Available variables are `${membership.name}`, `${membership.location}`,
            /// `${membership.project}` and `${membership.labels['label_name']}`.
            ///
            /// If you want to deploy a specific variant, say "default" to all the
            /// clusters, you can use "default" (string without any variables) as
            /// the variant_name_template.
            VariantNameTemplate(std::string::String),
        }
    }

    /// State indicates the desired state for the fleet package.
    /// Unspecified value is equivalent to `ACTIVE`. If state is set to
    /// `SUSPENDED`, active rollout (if any) will continue but no new rollouts will
    /// be scheduled.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.
        Unspecified,
        /// `FleetPackage` is intended to be active.
        Active,
        /// `FleetPackage` is intended to be suspended.
        Suspended,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::Suspended => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Suspended => std::option::Option::Some("SUSPENDED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::Suspended,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "SUSPENDED" => Self::Suspended,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::Suspended => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.configdelivery.v1.FleetPackage.State",
            ))
        }
    }
}

/// FleetPackageInfo represents the status of the `FleetPackage` across all the
/// target clusters.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FleetPackageInfo {
    /// Optional. The active rollout, if any. Format is
    /// `projects/{project}/locations/{location}/fleetPackages/{fleet_package}/rollouts/{rollout}`.
    pub active_rollout: std::string::String,

    /// Optional. The last completed rollout, if any. Format is
    /// `projects/{project}/locations/{location}/fleetPackages/{fleet_package}/rollouts/{rollout}`.
    pub last_completed_rollout: std::string::String,

    /// Optional. Output only. The current state of the `FleetPackage`.
    pub state: crate::model::fleet_package_info::State,

    /// Optional. Output only. Errors encountered during configuration deployment
    /// (if any).
    pub errors: std::vec::Vec<crate::model::FleetPackageError>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl FleetPackageInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [active_rollout][crate::model::FleetPackageInfo::active_rollout].
    pub fn set_active_rollout<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.active_rollout = v.into();
        self
    }

    /// Sets the value of [last_completed_rollout][crate::model::FleetPackageInfo::last_completed_rollout].
    pub fn set_last_completed_rollout<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.last_completed_rollout = v.into();
        self
    }

    /// Sets the value of [state][crate::model::FleetPackageInfo::state].
    pub fn set_state<T: std::convert::Into<crate::model::fleet_package_info::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [errors][crate::model::FleetPackageInfo::errors].
    pub fn set_errors<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::FleetPackageError>,
    {
        use std::iter::Iterator;
        self.errors = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for FleetPackageInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackageInfo"
    }
}

/// Defines additional types related to [FleetPackageInfo].
pub mod fleet_package_info {
    #[allow(unused_imports)]
    use super::*;

    /// Possible values for the `FleetPackage` state.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.
        Unspecified,
        /// `FleetPackage` is active.
        Active,
        /// `FleetPackage` is suspended.
        Suspended,
        /// `FleetPackage` has failed to reconcile.
        Failed,
        /// `FleetPackage` is being deleted.
        Deleting,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::Suspended => std::option::Option::Some(2),
                Self::Failed => std::option::Option::Some(3),
                Self::Deleting => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Suspended => std::option::Option::Some("SUSPENDED"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::Suspended,
                3 => Self::Failed,
                4 => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "SUSPENDED" => Self::Suspended,
                "FAILED" => Self::Failed,
                "DELETING" => Self::Deleting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::Suspended => serializer.serialize_i32(2),
                Self::Failed => serializer.serialize_i32(3),
                Self::Deleting => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.configdelivery.v1.FleetPackageInfo.State",
            ))
        }
    }
}

/// Information representing an error encountered during rolling out
/// configurations.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FleetPackageError {
    /// Optional. A description of the error.
    pub error_message: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl FleetPackageError {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [error_message][crate::model::FleetPackageError::error_message].
    pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.error_message = v.into();
        self
    }
}

impl wkt::message::Message for FleetPackageError {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.FleetPackageError"
    }
}

/// ClusterInfo represents status of a resource bundle rollout for a cluster.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClusterInfo {
    /// Output only. gkehub membership of target cluster
    pub membership: std::string::String,

    /// Output only. Desired state for the resource bundle.
    pub desired: std::option::Option<crate::model::ResourceBundleDeploymentInfo>,

    /// Output only. Initial state of the resource bundle prior to the deployment.
    pub initial: std::option::Option<crate::model::ResourceBundleDeploymentInfo>,

    /// Output only. Current state of the resource bundle.
    pub current: std::option::Option<crate::model::ResourceBundleDeploymentInfo>,

    /// Output only. State of the rollout for the cluster.
    pub state: crate::model::cluster_info::State,

    /// Output only. Unordered list. Messages convey additional information related
    /// to the deployment.
    pub messages: std::vec::Vec<std::string::String>,

    /// Output only. Timestamp when reconciliation starts.
    pub start_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when reconciliation ends.
    pub end_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ClusterInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [membership][crate::model::ClusterInfo::membership].
    pub fn set_membership<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.membership = v.into();
        self
    }

    /// Sets the value of [desired][crate::model::ClusterInfo::desired].
    pub fn set_desired<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundleDeploymentInfo>,
    {
        self.desired = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [desired][crate::model::ClusterInfo::desired].
    pub fn set_or_clear_desired<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundleDeploymentInfo>,
    {
        self.desired = v.map(|x| x.into());
        self
    }

    /// Sets the value of [initial][crate::model::ClusterInfo::initial].
    pub fn set_initial<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundleDeploymentInfo>,
    {
        self.initial = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [initial][crate::model::ClusterInfo::initial].
    pub fn set_or_clear_initial<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundleDeploymentInfo>,
    {
        self.initial = v.map(|x| x.into());
        self
    }

    /// Sets the value of [current][crate::model::ClusterInfo::current].
    pub fn set_current<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundleDeploymentInfo>,
    {
        self.current = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [current][crate::model::ClusterInfo::current].
    pub fn set_or_clear_current<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ResourceBundleDeploymentInfo>,
    {
        self.current = v.map(|x| x.into());
        self
    }

    /// Sets the value of [state][crate::model::ClusterInfo::state].
    pub fn set_state<T: std::convert::Into<crate::model::cluster_info::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [messages][crate::model::ClusterInfo::messages].
    pub fn set_messages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.messages = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [start_time][crate::model::ClusterInfo::start_time].
    pub fn set_start_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [start_time][crate::model::ClusterInfo::start_time].
    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::ClusterInfo::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::ClusterInfo::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ClusterInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ClusterInfo"
    }
}

/// Defines additional types related to [ClusterInfo].
pub mod cluster_info {
    #[allow(unused_imports)]
    use super::*;

    /// State of the rollout for the cluster.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.
        Unspecified,
        /// Waiting state.
        Waiting,
        /// In progress state.
        InProgress,
        /// Stalled state.
        Stalled,
        /// Completed state.
        Completed,
        /// Aborted state.
        Aborted,
        /// Cancelled state.
        Cancelled,
        /// Error state.
        Error,
        /// Unchanged state.
        Unchanged,
        /// Skipped state.
        Skipped,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Waiting => std::option::Option::Some(1),
                Self::InProgress => std::option::Option::Some(2),
                Self::Stalled => std::option::Option::Some(3),
                Self::Completed => std::option::Option::Some(4),
                Self::Aborted => std::option::Option::Some(5),
                Self::Cancelled => std::option::Option::Some(6),
                Self::Error => std::option::Option::Some(7),
                Self::Unchanged => std::option::Option::Some(8),
                Self::Skipped => std::option::Option::Some(9),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Waiting => std::option::Option::Some("WAITING"),
                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
                Self::Stalled => std::option::Option::Some("STALLED"),
                Self::Completed => std::option::Option::Some("COMPLETED"),
                Self::Aborted => std::option::Option::Some("ABORTED"),
                Self::Cancelled => std::option::Option::Some("CANCELLED"),
                Self::Error => std::option::Option::Some("ERROR"),
                Self::Unchanged => std::option::Option::Some("UNCHANGED"),
                Self::Skipped => std::option::Option::Some("SKIPPED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Waiting,
                2 => Self::InProgress,
                3 => Self::Stalled,
                4 => Self::Completed,
                5 => Self::Aborted,
                6 => Self::Cancelled,
                7 => Self::Error,
                8 => Self::Unchanged,
                9 => Self::Skipped,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "WAITING" => Self::Waiting,
                "IN_PROGRESS" => Self::InProgress,
                "STALLED" => Self::Stalled,
                "COMPLETED" => Self::Completed,
                "ABORTED" => Self::Aborted,
                "CANCELLED" => Self::Cancelled,
                "ERROR" => Self::Error,
                "UNCHANGED" => Self::Unchanged,
                "SKIPPED" => Self::Skipped,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Waiting => serializer.serialize_i32(1),
                Self::InProgress => serializer.serialize_i32(2),
                Self::Stalled => serializer.serialize_i32(3),
                Self::Completed => serializer.serialize_i32(4),
                Self::Aborted => serializer.serialize_i32(5),
                Self::Cancelled => serializer.serialize_i32(6),
                Self::Error => serializer.serialize_i32(7),
                Self::Unchanged => serializer.serialize_i32(8),
                Self::Skipped => serializer.serialize_i32(9),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.configdelivery.v1.ClusterInfo.State",
            ))
        }
    }
}

/// ResourceBundleDeploymentInfo represents the status of a resource bundle
/// deployment.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceBundleDeploymentInfo {
    /// Output only. Refers to a `ResourceBundle` release.
    pub release: std::string::String,

    /// Output only. Refers to a version of the `ResourceBundle` release.
    pub version: std::string::String,

    /// Output only. Refers to a variant in a `ResourceBundle` release.
    pub variant: std::string::String,

    /// Output only. Synchronization state of the `ResourceBundle` deployment.
    pub sync_state: crate::model::resource_bundle_deployment_info::SyncState,

    /// Output only. Unordered list. Messages contains information related to the
    /// `ResourceBundle` deployment. For example, in case of an error, indicate the
    /// reason for the error. In case of a pending deployment, reason for why the
    /// deployment of new release is pending.
    pub messages: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResourceBundleDeploymentInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [release][crate::model::ResourceBundleDeploymentInfo::release].
    pub fn set_release<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.release = v.into();
        self
    }

    /// Sets the value of [version][crate::model::ResourceBundleDeploymentInfo::version].
    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.version = v.into();
        self
    }

    /// Sets the value of [variant][crate::model::ResourceBundleDeploymentInfo::variant].
    pub fn set_variant<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.variant = v.into();
        self
    }

    /// Sets the value of [sync_state][crate::model::ResourceBundleDeploymentInfo::sync_state].
    pub fn set_sync_state<
        T: std::convert::Into<crate::model::resource_bundle_deployment_info::SyncState>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.sync_state = v.into();
        self
    }

    /// Sets the value of [messages][crate::model::ResourceBundleDeploymentInfo::messages].
    pub fn set_messages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.messages = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ResourceBundleDeploymentInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ResourceBundleDeploymentInfo"
    }
}

/// Defines additional types related to [ResourceBundleDeploymentInfo].
pub mod resource_bundle_deployment_info {
    #[allow(unused_imports)]
    use super::*;

    /// Synchronization state of the resource bundle deployment.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum SyncState {
        /// Unspecified state.
        Unspecified,
        /// Reconciling state.
        Reconciling,
        /// Stalled state.
        Stalled,
        /// Synced state.
        Synced,
        /// Pending state.
        Pending,
        /// Error state.
        Error,
        /// Deletion pending state.
        DeletionPending,
        /// Deleting state.
        Deleting,
        /// Deleted state.
        Deleted,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [SyncState::value] or
        /// [SyncState::name].
        UnknownValue(sync_state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod sync_state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl SyncState {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Reconciling => std::option::Option::Some(1),
                Self::Stalled => std::option::Option::Some(2),
                Self::Synced => std::option::Option::Some(3),
                Self::Pending => std::option::Option::Some(4),
                Self::Error => std::option::Option::Some(5),
                Self::DeletionPending => std::option::Option::Some(6),
                Self::Deleting => std::option::Option::Some(7),
                Self::Deleted => std::option::Option::Some(8),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("SYNC_STATE_UNSPECIFIED"),
                Self::Reconciling => std::option::Option::Some("RECONCILING"),
                Self::Stalled => std::option::Option::Some("STALLED"),
                Self::Synced => std::option::Option::Some("SYNCED"),
                Self::Pending => std::option::Option::Some("PENDING"),
                Self::Error => std::option::Option::Some("ERROR"),
                Self::DeletionPending => std::option::Option::Some("DELETION_PENDING"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Deleted => std::option::Option::Some("DELETED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for SyncState {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for SyncState {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for SyncState {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Reconciling,
                2 => Self::Stalled,
                3 => Self::Synced,
                4 => Self::Pending,
                5 => Self::Error,
                6 => Self::DeletionPending,
                7 => Self::Deleting,
                8 => Self::Deleted,
                _ => Self::UnknownValue(sync_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for SyncState {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "SYNC_STATE_UNSPECIFIED" => Self::Unspecified,
                "RECONCILING" => Self::Reconciling,
                "STALLED" => Self::Stalled,
                "SYNCED" => Self::Synced,
                "PENDING" => Self::Pending,
                "ERROR" => Self::Error,
                "DELETION_PENDING" => Self::DeletionPending,
                "DELETING" => Self::Deleting,
                "DELETED" => Self::Deleted,
                _ => Self::UnknownValue(sync_state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for SyncState {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Reconciling => serializer.serialize_i32(1),
                Self::Stalled => serializer.serialize_i32(2),
                Self::Synced => serializer.serialize_i32(3),
                Self::Pending => serializer.serialize_i32(4),
                Self::Error => serializer.serialize_i32(5),
                Self::DeletionPending => serializer.serialize_i32(6),
                Self::Deleting => serializer.serialize_i32(7),
                Self::Deleted => serializer.serialize_i32(8),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for SyncState {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SyncState>::new(
                ".google.cloud.configdelivery.v1.ResourceBundleDeploymentInfo.SyncState",
            ))
        }
    }
}

/// The fleet where the `FleetPackage` should be deployed.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Fleet {
    /// Required. The host project for the GKE fleet. Format is
    /// `projects/{project}`.
    pub project: std::string::String,

    /// Optional. selector allows targeting a subset of fleet members using their
    /// labels.
    pub selector: std::option::Option<crate::model::fleet::LabelSelector>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Fleet {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [project][crate::model::Fleet::project].
    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project = v.into();
        self
    }

    /// Sets the value of [selector][crate::model::Fleet::selector].
    pub fn set_selector<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::fleet::LabelSelector>,
    {
        self.selector = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [selector][crate::model::Fleet::selector].
    pub fn set_or_clear_selector<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::fleet::LabelSelector>,
    {
        self.selector = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Fleet {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.Fleet"
    }
}

/// Defines additional types related to [Fleet].
pub mod fleet {
    #[allow(unused_imports)]
    use super::*;

    /// A label selector is a label query over a set of resources. An empty label
    /// selector matches all objects.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct LabelSelector {
        /// Optional. match_labels is a map of {key,value} pairs. Each {key,value}
        /// pair must match an existing label key and value exactly in order to
        /// satisfy the match.
        pub match_labels: std::collections::HashMap<std::string::String, std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl LabelSelector {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [match_labels][crate::model::fleet::LabelSelector::match_labels].
        pub fn set_match_labels<T, K, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = (K, V)>,
            K: std::convert::Into<std::string::String>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.match_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
            self
        }
    }

    impl wkt::message::Message for LabelSelector {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.configdelivery.v1.Fleet.LabelSelector"
        }
    }
}

/// AllAtOnceStrategy causes all clusters to be updated concurrently.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AllAtOnceStrategy {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AllAtOnceStrategy {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for AllAtOnceStrategy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.AllAtOnceStrategy"
    }
}

/// RollingStrategy causes a specified number of clusters to be updated
/// concurrently until all clusters are updated.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RollingStrategy {
    /// Optional. Maximum number of clusters to update the resource bundle on
    /// concurrently.
    pub max_concurrent: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RollingStrategy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [max_concurrent][crate::model::RollingStrategy::max_concurrent].
    pub fn set_max_concurrent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.max_concurrent = v.into();
        self
    }
}

impl wkt::message::Message for RollingStrategy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.RollingStrategy"
    }
}

/// RolloutStrategy defines different ways to rollout a resource bundle across
/// a set of clusters.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RolloutStrategy {
    /// strategy defines how updates to a resource bundle should be rolled out
    /// across clusters.
    pub strategy: std::option::Option<crate::model::rollout_strategy::Strategy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RolloutStrategy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [strategy][crate::model::RolloutStrategy::strategy].
    ///
    /// Note that all the setters affecting `strategy` are mutually
    /// exclusive.
    pub fn set_strategy<
        T: std::convert::Into<std::option::Option<crate::model::rollout_strategy::Strategy>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.strategy = v.into();
        self
    }

    /// The value of [strategy][crate::model::RolloutStrategy::strategy]
    /// if it holds a `AllAtOnce`, `None` if the field is not set or
    /// holds a different branch.
    pub fn all_at_once(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::AllAtOnceStrategy>> {
        #[allow(unreachable_patterns)]
        self.strategy.as_ref().and_then(|v| match v {
            crate::model::rollout_strategy::Strategy::AllAtOnce(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [strategy][crate::model::RolloutStrategy::strategy]
    /// to hold a `AllAtOnce`.
    ///
    /// Note that all the setters affecting `strategy` are
    /// mutually exclusive.
    pub fn set_all_at_once<
        T: std::convert::Into<std::boxed::Box<crate::model::AllAtOnceStrategy>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.strategy = std::option::Option::Some(
            crate::model::rollout_strategy::Strategy::AllAtOnce(v.into()),
        );
        self
    }

    /// The value of [strategy][crate::model::RolloutStrategy::strategy]
    /// if it holds a `Rolling`, `None` if the field is not set or
    /// holds a different branch.
    pub fn rolling(&self) -> std::option::Option<&std::boxed::Box<crate::model::RollingStrategy>> {
        #[allow(unreachable_patterns)]
        self.strategy.as_ref().and_then(|v| match v {
            crate::model::rollout_strategy::Strategy::Rolling(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [strategy][crate::model::RolloutStrategy::strategy]
    /// to hold a `Rolling`.
    ///
    /// Note that all the setters affecting `strategy` are
    /// mutually exclusive.
    pub fn set_rolling<T: std::convert::Into<std::boxed::Box<crate::model::RollingStrategy>>>(
        mut self,
        v: T,
    ) -> Self {
        self.strategy =
            std::option::Option::Some(crate::model::rollout_strategy::Strategy::Rolling(v.into()));
        self
    }
}

impl wkt::message::Message for RolloutStrategy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.RolloutStrategy"
    }
}

/// Defines additional types related to [RolloutStrategy].
pub mod rollout_strategy {
    #[allow(unused_imports)]
    use super::*;

    /// strategy defines how updates to a resource bundle should be rolled out
    /// across clusters.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Strategy {
        /// AllAtOnceStrategy causes all clusters to be updated concurrently.
        AllAtOnce(std::boxed::Box<crate::model::AllAtOnceStrategy>),
        /// RollingStrategy causes a specified number of clusters to be updated
        /// concurrently until all clusters are updated.
        Rolling(std::boxed::Box<crate::model::RollingStrategy>),
    }
}

/// RolloutStrategyInfo represents the status of execution of different types of
/// rollout strategies. Only the field corresponding to the rollout strategy
/// specified at the rollout resource will be populated.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RolloutStrategyInfo {
    /// strategy represents result of applying one of the rollout strategies.
    pub strategy: std::option::Option<crate::model::rollout_strategy_info::Strategy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RolloutStrategyInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [strategy][crate::model::RolloutStrategyInfo::strategy].
    ///
    /// Note that all the setters affecting `strategy` are mutually
    /// exclusive.
    pub fn set_strategy<
        T: std::convert::Into<std::option::Option<crate::model::rollout_strategy_info::Strategy>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.strategy = v.into();
        self
    }

    /// The value of [strategy][crate::model::RolloutStrategyInfo::strategy]
    /// if it holds a `AllAtOnceStrategyInfo`, `None` if the field is not set or
    /// holds a different branch.
    pub fn all_at_once_strategy_info(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::AllAtOnceStrategyInfo>> {
        #[allow(unreachable_patterns)]
        self.strategy.as_ref().and_then(|v| match v {
            crate::model::rollout_strategy_info::Strategy::AllAtOnceStrategyInfo(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [strategy][crate::model::RolloutStrategyInfo::strategy]
    /// to hold a `AllAtOnceStrategyInfo`.
    ///
    /// Note that all the setters affecting `strategy` are
    /// mutually exclusive.
    pub fn set_all_at_once_strategy_info<
        T: std::convert::Into<std::boxed::Box<crate::model::AllAtOnceStrategyInfo>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.strategy = std::option::Option::Some(
            crate::model::rollout_strategy_info::Strategy::AllAtOnceStrategyInfo(v.into()),
        );
        self
    }

    /// The value of [strategy][crate::model::RolloutStrategyInfo::strategy]
    /// if it holds a `RollingStrategyInfo`, `None` if the field is not set or
    /// holds a different branch.
    pub fn rolling_strategy_info(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::RollingStrategyInfo>> {
        #[allow(unreachable_patterns)]
        self.strategy.as_ref().and_then(|v| match v {
            crate::model::rollout_strategy_info::Strategy::RollingStrategyInfo(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [strategy][crate::model::RolloutStrategyInfo::strategy]
    /// to hold a `RollingStrategyInfo`.
    ///
    /// Note that all the setters affecting `strategy` are
    /// mutually exclusive.
    pub fn set_rolling_strategy_info<
        T: std::convert::Into<std::boxed::Box<crate::model::RollingStrategyInfo>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.strategy = std::option::Option::Some(
            crate::model::rollout_strategy_info::Strategy::RollingStrategyInfo(v.into()),
        );
        self
    }
}

impl wkt::message::Message for RolloutStrategyInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.RolloutStrategyInfo"
    }
}

/// Defines additional types related to [RolloutStrategyInfo].
pub mod rollout_strategy_info {
    #[allow(unused_imports)]
    use super::*;

    /// strategy represents result of applying one of the rollout strategies.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Strategy {
        /// AllAtOnceStrategyInfo represents the status of AllAtOnce rollout strategy
        /// execution.
        AllAtOnceStrategyInfo(std::boxed::Box<crate::model::AllAtOnceStrategyInfo>),
        /// RollingStrategyInfo represents the status of Rolling rollout strategy
        /// execution.
        RollingStrategyInfo(std::boxed::Box<crate::model::RollingStrategyInfo>),
    }
}

/// AllAtOnceStrategyInfo represents the status of execution of AllAtOnce rollout
/// strategy.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AllAtOnceStrategyInfo {
    /// Unordered list. resource bundle's deployment status for all targeted
    /// clusters.
    pub clusters: std::vec::Vec<crate::model::ClusterInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AllAtOnceStrategyInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [clusters][crate::model::AllAtOnceStrategyInfo::clusters].
    pub fn set_clusters<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ClusterInfo>,
    {
        use std::iter::Iterator;
        self.clusters = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for AllAtOnceStrategyInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.AllAtOnceStrategyInfo"
    }
}

/// RollingStrategyInfo represents the status of execution of Rolling rollout
/// strategy.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RollingStrategyInfo {
    /// Unordered list. resource bundle's deployment status for all targeted
    /// clusters.
    pub clusters: std::vec::Vec<crate::model::ClusterInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RollingStrategyInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [clusters][crate::model::RollingStrategyInfo::clusters].
    pub fn set_clusters<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ClusterInfo>,
    {
        use std::iter::Iterator;
        self.clusters = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for RollingStrategyInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.RollingStrategyInfo"
    }
}

/// Message for requesting list of FleetPackage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFleetPackagesRequest {
    /// Required. Parent value for ListFleetPackagesRequest.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListFleetPackagesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListFleetPackagesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListFleetPackagesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListFleetPackagesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListFleetPackagesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListFleetPackagesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListFleetPackagesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListFleetPackagesRequest"
    }
}

/// Message for response to listing FleetPackage
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFleetPackagesResponse {
    /// The list of FleetPackage
    pub fleet_packages: std::vec::Vec<crate::model::FleetPackage>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListFleetPackagesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [fleet_packages][crate::model::ListFleetPackagesResponse::fleet_packages].
    pub fn set_fleet_packages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::FleetPackage>,
    {
        use std::iter::Iterator;
        self.fleet_packages = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListFleetPackagesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListFleetPackagesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListFleetPackagesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListFleetPackagesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListFleetPackagesResponse {
    type PageItem = crate::model::FleetPackage;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.fleet_packages
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a FleetPackage
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetFleetPackageRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetFleetPackageRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetFleetPackageRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetFleetPackageRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.GetFleetPackageRequest"
    }
}

/// Message for creating a FleetPackage
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateFleetPackageRequest {
    /// Required. Value for parent.
    pub parent: std::string::String,

    /// Required. Id of the requesting object
    /// If auto-generating Id server-side, remove this field and
    /// fleet_package_id from the method_signature of Create RPC
    pub fleet_package_id: std::string::String,

    /// Required. The resource being created.
    pub fleet_package: std::option::Option<crate::model::FleetPackage>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateFleetPackageRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateFleetPackageRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [fleet_package_id][crate::model::CreateFleetPackageRequest::fleet_package_id].
    pub fn set_fleet_package_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.fleet_package_id = v.into();
        self
    }

    /// Sets the value of [fleet_package][crate::model::CreateFleetPackageRequest::fleet_package].
    pub fn set_fleet_package<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::FleetPackage>,
    {
        self.fleet_package = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [fleet_package][crate::model::CreateFleetPackageRequest::fleet_package].
    pub fn set_or_clear_fleet_package<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::FleetPackage>,
    {
        self.fleet_package = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateFleetPackageRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateFleetPackageRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.CreateFleetPackageRequest"
    }
}

/// Message for updating a FleetPackage
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateFleetPackageRequest {
    /// Required. Field mask is used to specify the fields to be overwritten in the
    /// FleetPackage resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The resource being updated
    pub fleet_package: std::option::Option<crate::model::FleetPackage>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateFleetPackageRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateFleetPackageRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateFleetPackageRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [fleet_package][crate::model::UpdateFleetPackageRequest::fleet_package].
    pub fn set_fleet_package<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::FleetPackage>,
    {
        self.fleet_package = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [fleet_package][crate::model::UpdateFleetPackageRequest::fleet_package].
    pub fn set_or_clear_fleet_package<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::FleetPackage>,
    {
        self.fleet_package = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateFleetPackageRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateFleetPackageRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.UpdateFleetPackageRequest"
    }
}

/// Message for deleting a FleetPackage
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteFleetPackageRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. If set to true, any rollouts for this FleetPackage will also be
    /// deleted. (Otherwise, the request will only work if the fleet package has no
    /// rollouts.)
    pub force: bool,

    /// Optional. If set to true, then deleting an already deleted or non existing
    /// FleetPackage will succeed.
    pub allow_missing: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteFleetPackageRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteFleetPackageRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteFleetPackageRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteFleetPackageRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }

    /// Sets the value of [allow_missing][crate::model::DeleteFleetPackageRequest::allow_missing].
    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.allow_missing = v.into();
        self
    }
}

impl wkt::message::Message for DeleteFleetPackageRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.DeleteFleetPackageRequest"
    }
}

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have been cancelled successfully
    /// have
    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.OperationMetadata"
    }
}

/// `Release` represents a versioned release containing kubernetes manifests.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Release {
    /// Identifier. Name of the Release. Format is
    /// `projects/{project}/locations/location}/resourceBundles/{resource_bundle}/release/[a-z][a-z0-9\-]{0,62}`.
    pub name: std::string::String,

    /// Output only. Time `Release` was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Time `Release` was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Labels as key value pairs.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. lifecycle of the `Release`.
    pub lifecycle: crate::model::release::Lifecycle,

    /// Required. version of the `Release`. This must be v\<major\>.\<minor\>.\<patch\>.
    pub version: std::string::String,

    /// Output only. Time the `Release` was published.
    pub publish_time: std::option::Option<wkt::Timestamp>,

    /// Optional. `ResourceBundle` Release extra information e.g., artifact
    /// registry image path.
    pub info: std::option::Option<crate::model::ReleaseInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Release {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Release::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Release::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Release::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Release::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Release::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Release::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [lifecycle][crate::model::Release::lifecycle].
    pub fn set_lifecycle<T: std::convert::Into<crate::model::release::Lifecycle>>(
        mut self,
        v: T,
    ) -> Self {
        self.lifecycle = v.into();
        self
    }

    /// Sets the value of [version][crate::model::Release::version].
    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.version = v.into();
        self
    }

    /// Sets the value of [publish_time][crate::model::Release::publish_time].
    pub fn set_publish_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.publish_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [publish_time][crate::model::Release::publish_time].
    pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.publish_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [info][crate::model::Release::info].
    pub fn set_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ReleaseInfo>,
    {
        self.info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [info][crate::model::Release::info].
    pub fn set_or_clear_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ReleaseInfo>,
    {
        self.info = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Release {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.Release"
    }
}

/// Defines additional types related to [Release].
pub mod release {
    #[allow(unused_imports)]
    use super::*;

    /// Lifecycle indicates the state of the `Release`. A published release is
    /// immutable.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Lifecycle {
        /// indicates lifecycle has not been specified.
        Unspecified,
        /// indicates that the `Release` is being edited.
        Draft,
        /// indicates that the `Release` is now published (or released) and
        /// immutable.
        Published,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Lifecycle::value] or
        /// [Lifecycle::name].
        UnknownValue(lifecycle::UnknownValue),
    }

    #[doc(hidden)]
    pub mod lifecycle {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Lifecycle {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Draft => std::option::Option::Some(1),
                Self::Published => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("LIFECYCLE_UNSPECIFIED"),
                Self::Draft => std::option::Option::Some("DRAFT"),
                Self::Published => std::option::Option::Some("PUBLISHED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Lifecycle {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Lifecycle {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Lifecycle {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Draft,
                2 => Self::Published,
                _ => Self::UnknownValue(lifecycle::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Lifecycle {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "LIFECYCLE_UNSPECIFIED" => Self::Unspecified,
                "DRAFT" => Self::Draft,
                "PUBLISHED" => Self::Published,
                _ => Self::UnknownValue(lifecycle::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Lifecycle {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Draft => serializer.serialize_i32(1),
                Self::Published => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Lifecycle {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Lifecycle>::new(
                ".google.cloud.configdelivery.v1.Release.Lifecycle",
            ))
        }
    }
}

/// Variant represents the content of a `ResourceBundle` variant.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Variant {
    /// Optional. labels to represent any metadata associated with the variant.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Input only. Unordered list. resources contain the kubernetes
    /// manifests (YAMLs) for this variant.
    pub resources: std::vec::Vec<std::string::String>,

    /// Identifier. Name follows format of
    /// projects/{project}/locations/{location}/resourceBundles/{resource_bundle}/releases/{release}/variants/{variant}
    pub name: std::string::String,

    /// Output only. [Output only] Create time stamp
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. [Output only] Update time stamp
    pub update_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Variant {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [labels][crate::model::Variant::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [resources][crate::model::Variant::resources].
    pub fn set_resources<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.resources = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [name][crate::model::Variant::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Variant::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Variant::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Variant::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Variant::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Variant {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.Variant"
    }
}

/// Message for requesting list of Variants.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVariantsRequest {
    /// Required. Parent value for ListVariantsRequest.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListVariantsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListVariantsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListVariantsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListVariantsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListVariantsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListVariantsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListVariantsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListVariantsRequest"
    }
}

/// Message for response to listing Variants
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVariantsResponse {
    /// The list of Variants
    pub variants: std::vec::Vec<crate::model::Variant>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListVariantsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [variants][crate::model::ListVariantsResponse::variants].
    pub fn set_variants<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Variant>,
    {
        use std::iter::Iterator;
        self.variants = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListVariantsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListVariantsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListVariantsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListVariantsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListVariantsResponse {
    type PageItem = crate::model::Variant;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.variants
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Variant
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetVariantRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetVariantRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetVariantRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetVariantRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.GetVariantRequest"
    }
}

/// Message for creating a Variant
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateVariantRequest {
    /// Required. Value for parent.
    pub parent: std::string::String,

    /// Required. Id of the requesting object
    pub variant_id: std::string::String,

    /// Required. The resource being created
    pub variant: std::option::Option<crate::model::Variant>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateVariantRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateVariantRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [variant_id][crate::model::CreateVariantRequest::variant_id].
    pub fn set_variant_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.variant_id = v.into();
        self
    }

    /// Sets the value of [variant][crate::model::CreateVariantRequest::variant].
    pub fn set_variant<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Variant>,
    {
        self.variant = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [variant][crate::model::CreateVariantRequest::variant].
    pub fn set_or_clear_variant<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Variant>,
    {
        self.variant = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateVariantRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateVariantRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.CreateVariantRequest"
    }
}

/// Message for updating a Variant
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateVariantRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// Variant resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The resource being updated
    pub variant: std::option::Option<crate::model::Variant>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateVariantRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateVariantRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateVariantRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [variant][crate::model::UpdateVariantRequest::variant].
    pub fn set_variant<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Variant>,
    {
        self.variant = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [variant][crate::model::UpdateVariantRequest::variant].
    pub fn set_or_clear_variant<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Variant>,
    {
        self.variant = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateVariantRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateVariantRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.UpdateVariantRequest"
    }
}

/// Message for deleting a Variant
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteVariantRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteVariantRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteVariantRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteVariantRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteVariantRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.DeleteVariantRequest"
    }
}

/// ReleaseInfo contains extra information about the `ResourceBundle` release
/// e.g., link to an artifact registry OCI image.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReleaseInfo {
    /// Output only. path to the oci image the service uploads to on a `Release`
    /// creation.
    pub oci_image_path: std::string::String,

    /// Optional. per-variant paths to the oci images the service uploads on
    /// package release creation
    pub variant_oci_image_paths:
        std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReleaseInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [oci_image_path][crate::model::ReleaseInfo::oci_image_path].
    pub fn set_oci_image_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.oci_image_path = v.into();
        self
    }

    /// Sets the value of [variant_oci_image_paths][crate::model::ReleaseInfo::variant_oci_image_paths].
    pub fn set_variant_oci_image_paths<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.variant_oci_image_paths = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for ReleaseInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ReleaseInfo"
    }
}

/// Message for requesting list of Releases.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListReleasesRequest {
    /// Required. Parent value for ListReleasesRequest.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListReleasesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListReleasesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListReleasesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListReleasesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListReleasesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListReleasesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListReleasesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListReleasesRequest"
    }
}

/// Message for response to listing Releases
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListReleasesResponse {
    /// The list of Releases
    pub releases: std::vec::Vec<crate::model::Release>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListReleasesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [releases][crate::model::ListReleasesResponse::releases].
    pub fn set_releases<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Release>,
    {
        use std::iter::Iterator;
        self.releases = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListReleasesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListReleasesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListReleasesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListReleasesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListReleasesResponse {
    type PageItem = crate::model::Release;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.releases
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Release
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetReleaseRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetReleaseRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetReleaseRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetReleaseRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.GetReleaseRequest"
    }
}

/// Message for creating a Release
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateReleaseRequest {
    /// Required. Value for parent.
    pub parent: std::string::String,

    /// Required. Id of the requesting object
    /// If auto-generating Id server-side, remove this field and
    /// release_id from the method_signature of Create RPC
    pub release_id: std::string::String,

    /// Required. The resource being created
    pub release: std::option::Option<crate::model::Release>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateReleaseRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateReleaseRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [release_id][crate::model::CreateReleaseRequest::release_id].
    pub fn set_release_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.release_id = v.into();
        self
    }

    /// Sets the value of [release][crate::model::CreateReleaseRequest::release].
    pub fn set_release<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Release>,
    {
        self.release = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [release][crate::model::CreateReleaseRequest::release].
    pub fn set_or_clear_release<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Release>,
    {
        self.release = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateReleaseRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateReleaseRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.CreateReleaseRequest"
    }
}

/// Message for updating a Release
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateReleaseRequest {
    /// Required. Field mask is used to specify the fields to be overwritten in the
    /// Release resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The resource being updated
    pub release: std::option::Option<crate::model::Release>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateReleaseRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateReleaseRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateReleaseRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [release][crate::model::UpdateReleaseRequest::release].
    pub fn set_release<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Release>,
    {
        self.release = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [release][crate::model::UpdateReleaseRequest::release].
    pub fn set_or_clear_release<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Release>,
    {
        self.release = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateReleaseRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateReleaseRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.UpdateReleaseRequest"
    }
}

/// Message for deleting a Release
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteReleaseRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. If set to true, any variants of this release will also be
    /// deleted. (Otherwise, the request will only work if the release has no
    /// variants.)
    pub force: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteReleaseRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteReleaseRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteReleaseRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [force][crate::model::DeleteReleaseRequest::force].
    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.force = v.into();
        self
    }
}

impl wkt::message::Message for DeleteReleaseRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.DeleteReleaseRequest"
    }
}

/// Message for requesting list of Rollouts
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRolloutsRequest {
    /// Required. Parent value for ListRolloutsRequest
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRolloutsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRolloutsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRolloutsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRolloutsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListRolloutsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListRolloutsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListRolloutsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListRolloutsRequest"
    }
}

/// Message for response to listing Rollouts
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRolloutsResponse {
    /// The list of Rollouts
    pub rollouts: std::vec::Vec<crate::model::Rollout>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRolloutsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [rollouts][crate::model::ListRolloutsResponse::rollouts].
    pub fn set_rollouts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Rollout>,
    {
        use std::iter::Iterator;
        self.rollouts = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRolloutsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListRolloutsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListRolloutsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ListRolloutsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRolloutsResponse {
    type PageItem = crate::model::Rollout;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.rollouts
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Rollout
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRolloutRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRolloutRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRolloutRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRolloutRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.GetRolloutRequest"
    }
}

/// RolloutInfo represents the state of the `FleetPackage` at all the
/// clusters the rollout is targeting.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RolloutInfo {
    /// Output only. state contains the overall status of the Rollout.
    pub state: crate::model::rollout_info::State,

    /// Output only. Time when the rollout started.
    pub start_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Time when the rollout completed.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Message containing additional information related to the
    /// rollout.
    pub message: std::string::String,

    /// Output only. Rollout strategy info represents the status of execution of
    /// rollout strategy.
    pub rollout_strategy_info: std::option::Option<crate::model::RolloutStrategyInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RolloutInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [state][crate::model::RolloutInfo::state].
    pub fn set_state<T: std::convert::Into<crate::model::rollout_info::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [start_time][crate::model::RolloutInfo::start_time].
    pub fn set_start_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [start_time][crate::model::RolloutInfo::start_time].
    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::RolloutInfo::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::RolloutInfo::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [message][crate::model::RolloutInfo::message].
    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.message = v.into();
        self
    }

    /// Sets the value of [rollout_strategy_info][crate::model::RolloutInfo::rollout_strategy_info].
    pub fn set_rollout_strategy_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RolloutStrategyInfo>,
    {
        self.rollout_strategy_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rollout_strategy_info][crate::model::RolloutInfo::rollout_strategy_info].
    pub fn set_or_clear_rollout_strategy_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RolloutStrategyInfo>,
    {
        self.rollout_strategy_info = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for RolloutInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.RolloutInfo"
    }
}

/// Defines additional types related to [RolloutInfo].
pub mod rollout_info {
    #[allow(unused_imports)]
    use super::*;

    /// State of the rollout
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Unspecified state.
        Unspecified,
        /// Rollout completed.
        Completed,
        /// Rollout suspended.
        Suspended,
        /// Rollout aborted.
        Aborted,
        /// Rollout in progress.
        InProgress,
        /// Rollout stalled.
        Stalled,
        /// Rollout cancelled.
        Cancelled,
        /// Rollout aborting.
        Aborting,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Completed => std::option::Option::Some(1),
                Self::Suspended => std::option::Option::Some(2),
                Self::Aborted => std::option::Option::Some(3),
                Self::InProgress => std::option::Option::Some(5),
                Self::Stalled => std::option::Option::Some(6),
                Self::Cancelled => std::option::Option::Some(7),
                Self::Aborting => std::option::Option::Some(8),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Completed => std::option::Option::Some("COMPLETED"),
                Self::Suspended => std::option::Option::Some("SUSPENDED"),
                Self::Aborted => std::option::Option::Some("ABORTED"),
                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
                Self::Stalled => std::option::Option::Some("STALLED"),
                Self::Cancelled => std::option::Option::Some("CANCELLED"),
                Self::Aborting => std::option::Option::Some("ABORTING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Completed,
                2 => Self::Suspended,
                3 => Self::Aborted,
                5 => Self::InProgress,
                6 => Self::Stalled,
                7 => Self::Cancelled,
                8 => Self::Aborting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "COMPLETED" => Self::Completed,
                "SUSPENDED" => Self::Suspended,
                "ABORTED" => Self::Aborted,
                "IN_PROGRESS" => Self::InProgress,
                "STALLED" => Self::Stalled,
                "CANCELLED" => Self::Cancelled,
                "ABORTING" => Self::Aborting,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Completed => serializer.serialize_i32(1),
                Self::Suspended => serializer.serialize_i32(2),
                Self::Aborted => serializer.serialize_i32(3),
                Self::InProgress => serializer.serialize_i32(5),
                Self::Stalled => serializer.serialize_i32(6),
                Self::Cancelled => serializer.serialize_i32(7),
                Self::Aborting => serializer.serialize_i32(8),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.configdelivery.v1.RolloutInfo.State",
            ))
        }
    }
}

/// Rollout resource represents an instance of `FleetPackage` rollout operation
/// across a fleet. This is a system generated resource and will be read only for
/// end-users. It will be primarily used by the service to process the changes in
/// the `FleetPackage` and other changes in the environment.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Rollout {
    /// Identifier. Name of the Rollout. Format is
    /// `projects/{project}/locations/{location}/fleetPackages/{fleet_package}/rollouts/[a-z][a-z0-9\-]{0,62}`.
    pub name: std::string::String,

    /// Reference to the `Release` being rolled out.
    pub release: std::string::String,

    /// Rollout strategy for rolling out `FleetPackage` to clusters.
    pub rollout_strategy: std::option::Option<crate::model::RolloutStrategy>,

    /// Current details of the rollout.
    pub info: std::option::Option<crate::model::RolloutInfo>,

    /// Deletion propagation policy of the rollout.
    pub deletion_propagation_policy: crate::model::DeletionPropagationPolicy,

    /// Output only. The time the rollout was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the rollout was most recently updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Rollout {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Rollout::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [release][crate::model::Rollout::release].
    pub fn set_release<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.release = v.into();
        self
    }

    /// Sets the value of [rollout_strategy][crate::model::Rollout::rollout_strategy].
    pub fn set_rollout_strategy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RolloutStrategy>,
    {
        self.rollout_strategy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [rollout_strategy][crate::model::Rollout::rollout_strategy].
    pub fn set_or_clear_rollout_strategy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RolloutStrategy>,
    {
        self.rollout_strategy = v.map(|x| x.into());
        self
    }

    /// Sets the value of [info][crate::model::Rollout::info].
    pub fn set_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::RolloutInfo>,
    {
        self.info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [info][crate::model::Rollout::info].
    pub fn set_or_clear_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::RolloutInfo>,
    {
        self.info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [deletion_propagation_policy][crate::model::Rollout::deletion_propagation_policy].
    pub fn set_deletion_propagation_policy<
        T: std::convert::Into<crate::model::DeletionPropagationPolicy>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.deletion_propagation_policy = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Rollout::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Rollout::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Rollout::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Rollout::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Rollout {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.Rollout"
    }
}

/// Message for suspending a rollout.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuspendRolloutRequest {
    /// Required. Name of the Rollout.
    pub name: std::string::String,

    /// Optional. Reason for suspension.
    pub reason: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SuspendRolloutRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SuspendRolloutRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [reason][crate::model::SuspendRolloutRequest::reason].
    pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.reason = v.into();
        self
    }
}

impl wkt::message::Message for SuspendRolloutRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.SuspendRolloutRequest"
    }
}

/// Message for resuming a rollout.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResumeRolloutRequest {
    /// Required. Name of the Rollout.
    pub name: std::string::String,

    /// Optional. Reason for resuming the rollout.
    pub reason: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ResumeRolloutRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ResumeRolloutRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [reason][crate::model::ResumeRolloutRequest::reason].
    pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.reason = v.into();
        self
    }
}

impl wkt::message::Message for ResumeRolloutRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.ResumeRolloutRequest"
    }
}

/// Message for aborting a rollout.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AbortRolloutRequest {
    /// Required. Name of the Rollout.
    pub name: std::string::String,

    /// Optional. Reason for aborting.
    pub reason: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AbortRolloutRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::AbortRolloutRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [reason][crate::model::AbortRolloutRequest::reason].
    pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.reason = v.into();
        self
    }
}

impl wkt::message::Message for AbortRolloutRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.configdelivery.v1.AbortRolloutRequest"
    }
}

/// Deletion Propagation Policy determines what happens to the underlying
/// Kubernetes resources on a cluster when the `FleetPackage` managing
/// those resources no longer targets the cluster or is deleted.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DeletionPropagationPolicy {
    /// Unspecified deletion propagation policy. Defaults to FOREGROUND.
    Unspecified,
    /// Foreground deletion propagation policy. Any resources synced to the cluster
    /// will be deleted.
    Foreground,
    /// Orphan deletion propagation policy. Any resources synced to the cluster
    /// will be abandoned.
    Orphan,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [DeletionPropagationPolicy::value] or
    /// [DeletionPropagationPolicy::name].
    UnknownValue(deletion_propagation_policy::UnknownValue),
}

#[doc(hidden)]
pub mod deletion_propagation_policy {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl DeletionPropagationPolicy {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Foreground => std::option::Option::Some(1),
            Self::Orphan => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => {
                std::option::Option::Some("DELETION_PROPAGATION_POLICY_UNSPECIFIED")
            }
            Self::Foreground => std::option::Option::Some("FOREGROUND"),
            Self::Orphan => std::option::Option::Some("ORPHAN"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for DeletionPropagationPolicy {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for DeletionPropagationPolicy {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for DeletionPropagationPolicy {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Foreground,
            2 => Self::Orphan,
            _ => Self::UnknownValue(deletion_propagation_policy::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for DeletionPropagationPolicy {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "DELETION_PROPAGATION_POLICY_UNSPECIFIED" => Self::Unspecified,
            "FOREGROUND" => Self::Foreground,
            "ORPHAN" => Self::Orphan,
            _ => Self::UnknownValue(deletion_propagation_policy::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for DeletionPropagationPolicy {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Foreground => serializer.serialize_i32(1),
            Self::Orphan => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for DeletionPropagationPolicy {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(
            wkt::internal::EnumVisitor::<DeletionPropagationPolicy>::new(
                ".google.cloud.configdelivery.v1.DeletionPropagationPolicy",
            ),
        )
    }
}
